package com.huatai.range.controller;

import com.huatai.common.api.R;
import com.huatai.range.entity.TbTrialInfoEntity;
import com.huatai.range.feign.TrialInfoClient;
import com.huatai.range.query.AliasExistQuery;
import com.huatai.range.service.TrialTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @ClassName TrialTableController
 * @Description TODO
 * @Author luoxc
 * @Date 2023/4/18 18:37
 * @Version 1.0
 */

@RestController
@RequestMapping("trialTab")
@Api(tags = "试验表管理", value = "试验表管理")
public class TrialTableController {

	@Autowired
	private TrialTableService trialTableService;

	@GetMapping("getByTrialId")
	@ApiOperation(value = "通过试验id查询试验表", notes = "通过试验id查询试验表")
	public R getByTrialId(@ApiParam(name = "trialId", value = "试验id", required = true) @RequestParam("trialId") String trialId) {
		return R.data(trialTableService.getByTrialId(trialId));
	}

	@GetMapping("getTrialList")
	@ApiOperation(value = "获取有试验区的试验列表", notes = "获取有试验区的试验列表")
	public R getTrialList() {
		return R.data(trialTableService.getTrialList());
	}

	@PostMapping("existByAlias")
	@ApiOperation(value = "判断表别名是否存在", notes = "判断表别名是否存在")
	public R existByAlias(@RequestBody AliasExistQuery aliasExistQuery) {
		return R.data(trialTableService.existByAlias(aliasExistQuery));
	}

}
